﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerAttack : MonoBehaviour
{
    public Transform fireTran;

    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Vector3 mouse = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            mouse.z = 0;
            float fireAngle = Vector3.Angle(mouse - transform.position, Vector2.up);
            if (mouse.x > transform.position.x)
            {
                fireAngle = -fireAngle;
            }
            Vector3 rot = new Vector3(0, 0, fireAngle + 90);
            Vector2 v = (mouse - transform.position).normalized * 20;

            CmdAttack(rot, v);
            //Bullet b = go.GetComponent<Bullet>();
            //b.
        }
    }

    private void CmdAttack(Vector3 rot, Vector2 v)
    {
    }
}
